<template>
	<view class="page" :style="themeColor">
		<view
			class="flex flex-direction flex-wrap align-stretch justify-center benben-position-layout flex iNeedFeedback_flex_0"
			:style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx'}">
			<view class='flex flex-wrap align-stretch justify-between iNeedFeedback_fd0_0'>
				<view class='flex flex-wrap align-center iNeedFeedback_fd0_0_c0' style="padding-top: 16rpx;">
					<person></person>
				</view>
				<view class='flex flex-wrap align-center'>
					<text class='iNeedFeedback_fd0_0_c1_c0'>我要反馈</text>
				</view>
				<view class='flex align-center justify-end iNeedFeedback_fd0_0_c2' @tap.stop="handleJumpDiy"
					data-type="navigateTo" :data-url="`/pages/xtsz/historicalFeedback/historicalFeedback`">
					<text class='iNeedFeedback_fd0_0_c2_c0'>反馈记录</text>
				</view>
			</view>

		</view>
		<view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
		
		<!---意见反馈表单flex布局开始-->
		<view class="flex flex-direction flex-wrap align-stretch benben-flex-layout iNeedFeedback_flex_1">
			<view style="padding: 8rpx 0;margin: 0 32rpx;">
				<back></back>
			</view>
			<view class='flex flex-wrap align-center iNeedFeedback_fd1_0'>
				<text class='iNeedFeedback_fd1_0_c0'>反馈类型</text>
			</view>
			<view class='flex flex-direction flex-wrap align-stretch iNeedFeedback_fd1_1'>
				<benben-select-diy ref="showSelectPopup1681201808828" class-name='flex flex-wrap align-center flex'
					:items.sync="select_type" v-model="select_id" default-type="id" default-label="title"
					:allow-cancel='false' type="radio" :disabled='false'>
					<template v-for='(item,key0) in select_type'>
						<view v-if="item.isSelected"
							class='flex align-center justify-center flex iNeedFeedback_fd1_1_c0_c0' :key="key0"
							@tap="$refs.showSelectPopup1681201808828.tapHandle(key0)">
							<text class='flex-sub iNeedFeedback_fd1_1_c0_c0_c0'>{{item.title}}</text>
						</view>
						<view v-else class='flex align-center justify-center flex iNeedFeedback_fd1_1_c0_c1' :key="key0"
							@tap="$refs.showSelectPopup1681201808828.tapHandle(key0)">
							<text class='flex-sub iNeedFeedback_fd1_1_c0_c1_c0'>{{item.title}}</text>
						</view>
					</template></benben-select-diy>
			</view>
			<text class='iNeedFeedback_fd1_2'>反馈内容</text>
			<view class='flex flex-direction flex-wrap align-stretch iNeedFeedback_fd1_3'>
				<view class='flex flex-wrap iNeedFeedback_fd1_3_c0'>
					<textarea class='flex iNeedFeedback_input_fd1_3_c0' confirm-type="done"
						:placeholder="'问题描述的越详细，有助于我们更快的解决问题'" :maxlength="240"
						placeholder-style="color:#999;font-size:28rpx" v-model="problemDescription" />

				</view>
				<view class='flex flex-direction flex-wrap align-stretch'>
					<benben-images-upload ref="benbenImagesUploadfd1_3_c1_c0" :img-list.sync="imgList"
						:img-ids.sync="imgIds" :is-show-tips='true' :maxlength="6">
						<template #content="{ num, maxlength, isShow, imgList }">
							<view class="flex flex-wrap align-start flex iNeedFeedback_fd1_3_c1_c0">

								<view v-for="(image, index) in imgList" :key="index"
									class='flex position-relative iNeedFeedback_fd1_3_c1_c00'>
									<text class='fu-iconfont2 position-absolute iNeedFeedback_fd1_3_c1_c000'
										@tap.stop="$refs.benbenImagesUploadfd1_3_c1_c0.delImage(index)">&#xE8E7;</text>
									<image class='iNeedFeedback_fd1_3_c1_c001'
										@tap.stop="$refs.benbenImagesUploadfd1_3_c1_c0.previewImage(index)"
										mode="aspectFill" :src='image'>
									</image>
								</view>

								<image class='iNeedFeedback_fd1_3_c1_c01'
									@tap.stop="$refs.benbenImagesUploadfd1_3_c1_c0.manyChooseImage()" v-if="isShow"
									mode="aspectFill" :src='STATIC_URL+"48.jpg"'></image>
								<text
									class='image_upload_tips iNeedFeedback_fd1_3_c1_c02'>最多上传{{num}}/{{maxlength}}张图片</text>
							</view>
						</template>
					</benben-images-upload>
				</view>
			</view>
		</view>

		<!---意见反馈表单flex布局结束-->
		<view class="flex flex-wrap align-start justify-center benben-position-layout flex iNeedFeedback_flex_2">
			<button class='flex-sub iNeedFeedback_fd2_0' @tap.stop="sumbitFunc()">提交</button>

		</view>
		<view :style="{height: '136rpx'}"></view>


	</view>
</template>
<script>
	import {
		validate
	} from '@/common/utils/validate.js'
	import back from "@/components/back/index.vue"
	import person from "@/components/person/index.vue"
	export default {
		components: {
			back,
			person
		},


		data() {
			return {
				"select_id": "",
				"select_type": [],
				"problemDescription": "",
				"singleImageUpload": [],
				imgList: [],
				imgIds: '',
			};
		},
		computed: {
			themeColor() {
				return this.$store.getters.themeColor
			},

		},
		watch: {},
		onLoad(options) {
			this.getfankui()
		},
		onUnload() {

		},
		onReady() {

		},
		onShow() {

		},
		onHide() {

		},
		onResize() {

		},
		onPullDownRefresh() {

		},
		onReachBottom(e) {

		},
		onPageScroll(e) {

		},
		methods: {
			//反馈类型
			async getfankui() {
				let res = await this.$api.post(global.apiUrls.fankuileixing)
				if (res.data.code != 1) {
					this.$message.info(res.data.msg)
					return
				}
				this.select_type = res.data.data
				console.log(this.select_type, 'this.select_type')
			},
			//提交
			async sumbitFunc() {
				//数据验证
				if (!this.select_id) return this.$message.info('请选择反馈类型！');
				if (!this.problemDescription) return this.$message.info('请输入反馈内容！');
				//请求方法
				let str = this.imgList.length > 0 ? this.imgList.join(',') : '';
				let dataresult = await this.$api.post(global.apiUrls.woyaofankui, {
					operationsuggestionstype_id: this.select_id,
					body: this.problemDescription,
					thumb: str,

				});
				if (dataresult.data.code != 1) {
					this.$message.info(dataresult.data.msg);
					return;
				}
				this.$message.info('提交成功');
				setTimeout(() => {
					uni.redirectTo({
						url: '/pages/xtsz/historicalFeedback/historicalFeedback'
					})
				}, 800);
			}
		}
	};
</script>
<style lang="scss" scoped>
	.page {
		width: 100vw;
		overflow-x: hidden;
		min-height: calc(100vh - var(--window-bottom));
		background: #fff;
		background-size: 100% auto !important;
	}

	.iNeedFeedback_flex_0 {
		border-bottom: 1px solid #eee;
		background: #fff;
		width: 750rpx;
		height: 88rpx;
		overflow: hidden;
		z-index: 10;
		top: 0rpx;
		background-size: 100% auto !important;
	}

	.iNeedFeedback_fd0_0_c2_c0 {
		font-size: 32rpx;
		font-weight: 500;
		color: rgba(106, 0, 2, 1);
	}

	.iNeedFeedback_fd0_0_c2 {
		padding: 0rpx 0rpx 0rpx 0rpx;
		width: 200rpx;
	}

	.iNeedFeedback_fd0_0_c1_c0 {
		font-size: 36rpx;
		font-weight: 500;
		color: #333333;
		line-height: 50rpx;
	}

	.iNeedFeedback_fd0_0_c0_c0 {
		font-size: 36rpx;
		font-weight: 400;
		color: #333;
	}

	.iNeedFeedback_fd0_0_c0 {
		width: 200rpx;
	}

	.iNeedFeedback_fd0_0 {
		padding: 0rpx 32rpx 0rpx 32rpx;
		line-height: 88rpx;
	}

	.iNeedFeedback_flex_1 {
		background: #fff;
		background-size: 100% auto !important;
	}

	.iNeedFeedback_fd1_3_c1_c02 {
		font-size: 24rpx;
		color: rgba(191, 191, 191, 1);
		font-weight: 400;
		width: 100%;
	}

	.iNeedFeedback_fd1_3_c1_c01 {
		width: 160rpx;
		height: 160rpx;
		margin: 0rpx 24rpx 24rpx 0rpx;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
	}

	.iNeedFeedback_fd1_3_c1_c001 {
		width: 160rpx;
		height: 160rpx;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
	}

	.iNeedFeedback_fd1_3_c1_c000 {
		top: 0rpx;
		right: 0rpx;
		z-index: 10;
		color: #ff5536;
	}

	.iNeedFeedback_fd1_3_c1_c00 {
		margin: 0rpx 24rpx 24rpx 0rpx;
	}

	.iNeedFeedback_fd1_3_c1_c0 {
		padding: 24rpx 0rpx 0rpx 24rpx;
	}

	.iNeedFeedback_input_fd1_3_c0 {
		width: 100%;
		height: 166rpx;
		font-size: 28rpx;
		font-weight: 400;
		color: #333;
	}

	.iNeedFeedback_fd1_3_c0 {
		width: 686rpx;
		border-radius: 10rpx 10rpx 10rpx 10rpx;
		margin: 0rpx 0rpx 0rpx 32rpx;
		padding: 0rpx 0rpx 24rpx 0rpx;
	}

	.iNeedFeedback_fd1_3 {
		margin: 0rpx 0rpx 32rpx 0rpx;
	}

	.iNeedFeedback_fd1_2 {
		font-size: 32rpx;
		font-weight: 500;
		color: #1A1A1A;
		line-height: 109rpx;
		margin: 0rpx 32rpx 0rpx 32rpx;
	}

	.iNeedFeedback_fd1_1_c0_c1_c0 {
		font-size: 28rpx;
		font-weight: 400;
		color: rgba(153, 153, 153, 1);
		line-height: 62rpx;
		-webkit-line-clamp: 1;
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		text-align: center;
	}

	.iNeedFeedback_fd1_1_c0_c1 {
		border: 1px solid rgba(191, 191, 191, 1);
		background: #fff;
		margin: 16rpx 16rpx 16rpx 16rpx;
		height: 64rpx;
		border-radius: 8rpx 8rpx 8rpx 8rpx;
		width: 206rpx;
		padding: 0rpx 10rpx 0rpx 10rpx;
	}

	.iNeedFeedback_fd1_1_c0_c0_c0 {
		font-size: 28rpx;
		font-weight: 400;
		color: #fff;
		line-height: 62rpx;
		-webkit-line-clamp: 1;
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		text-align: center;
	}

	.iNeedFeedback_fd1_1_c0_c0 {
		border: 1px solid;
		background: #6a0002;
		margin: 16rpx 16rpx 16rpx 16rpx;
		height: 64rpx;
		border-radius: 8rpx 8rpx 8rpx 8rpx;
		width: 206rpx;
		padding: 0rpx 10rpx 0rpx 10rpx;
	}

	.iNeedFeedback_fd1_1 {
		border-bottom: 10px solid rgba(246, 247, 248, 1);
		padding: 0rpx 16rpx 16rpx 16rpx;
	}

	.iNeedFeedback_fd1_0_c0 {
		font-size: 32rpx;
		font-weight: 500;
		color: #1A1A1A;
		margin: 0rpx 32rpx 0rpx 32rpx;
	}

	.iNeedFeedback_fd1_0 {
		padding: 32rpx 0rpx 32rpx 0rpx;
	}

	.iNeedFeedback_flex_2 {
		width: 750rpx;
		height: 136rpx;
		overflow: hidden;
		z-index: 5;
		bottom: calc(0rpx + var(--window-bottom));
	}

	.iNeedFeedback_fd2_0 {
		background: var(--benbenbgColor2);
		border-radius: 100rpx 100rpx 100rpx 100rpx;
		font-size: 32rpx;
		color: #fff;
		margin: 0rpx 32rpx 0rpx 32rpx;
		height: 88rpx;
		line-height: 88rpx;
		width: 686rpx;
		font-weight: 400;
	}
</style>